<template>
	<div class="container">
		<navi @selectTab="select" :currentInit="current"></navi>
		<follow ref="methodsHanld" v-if="current == 0"></follow>
		<list ref="methodsHanld" v-if="current == 1"></list>
		<nearby ref="methodsHanld" v-if="current == 2"></nearby>
		<tabBar currentPage="/pages/index/index"></tabBar>
	</div>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import data from '@/js/index/index/data.js';
	import methods from '@/js/index/index/methods.js';

	import navi from '@/components/nav.vue';
	import list from './list.vue';
	import follow from './follow.vue';
	import nearby from './nearby.vue';
	export default {

		data,
		methods,
		onLoad(e) {
			this.$nextTick(() => {
				this.$refs.methodsHanld.onShowHanlder(e);
			})
		},
		onShow() {
			if (this.refreshFlag) {
				console.log('刷新首页')
				this.$nextTick(() => {
					this.$refs.methodsHanld.onShowHanlder();

				})
			}

		},
		onPullDownRefresh() {
			this.$nextTick(() => {
				this.$refs.methodsHanld.onPullDownRefreshHanlder();
			})
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onHide() {

		},
		onUnload() {

		},
		onReachBottom() {
			this.$refs.methodsHanld.onReachBottomHanlder();
		},
		computed: {
			...mapState(['navigationBarHeight', 'userInfo', 'refreshFlag']),
			bgHeight() {
				// #ifdef APP-PLUS
				return 250
				// #endif
				return this.navigationBarHeight + uni.upx2px(364);
			}
		},
		components: {
			navi,
			list,
			follow,
			nearby
		}
	};
</script>
<style>
	page,
	uni-page {
		background-color: #FAFAFA !important;
	}
</style>
<style scoped lang="scss">
	@import '~@/style/index/index.scss';
</style>